import {createStore,combineReducers,applyMiddleware} from 'redux';   
import thunk from 'redux-thunk'; 

const listReducer = (state={list:[]},action)=>{
    switch (action.type) {
        case 'add_item':
            return {...state,list:[...state.list,action.payload]}
        case 'del':
            return {list:action.payload}
        default:
            return state;
    }
}

const rootReducer = combineReducers({
    list:listReducer
})

const store = createStore(
    rootReducer,
    applyMiddleware(thunk)
)
export default store;